<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>数据统计</li>
    <li>出库统计</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form id="customStatisForm" th:action="@{/statis/deliveryStatis}" method="post">
    <ul class="tools">
      <li> 所属区域：
        <select name="provinceId" id="provinceId">
          <option value="" text="请选择省份">请选择省份</option>
          <option th:each=" province : ${provinceList}" th:value="${province.id}" th:text="${province.pName}" th:selected="${conn.provinceId==province.id}"></option>
        </select >
        <select name="cityId" id="cityId">
          <option value="" text="请选择省份">请选择城市</option>
          <option th:each="city:${cities}" th:value="${city.id}" th:text="${city.cName}" th:selected="${conn.cityId==city.id}" >北京</option>
        </select>
      </li>
      <li> 仓库名称:
        <input type="text" name="ck_name" id="ck_name" th:value="${conn ==null?'':conn.ck_name}" />
      </li>
      <li> 时间:
        <input type="text" name="starttime" id="starttime" value=""/>-<input type="text" name="endtime" id="endtime" value=""/>
      </li>

      <li class="subBut" onclick="chaxun()"><img th:src="@{/images/t06.png}" />查询</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>仓库名称</th>
          <th>负责人</th>
          <th>所属区域</th>
          <th>出库数量</th>
          <th>金额</th>
          <th>出库明细</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each=" delivery : ${deliveryStatisList.data}">
          <td>[[${delivery.ck_id}]]</td>
          <td>[[${delivery.ck_name}]]</td>
          <td>[[${delivery.user_name}]]</td>
          <td>[[${delivery.p_name}]][[${delivery.city_name}]]</td>
          <td>[[${delivery.deliverynum}]]</td>
          <td>￥[[${delivery.totalprice}]]</td>
          <td>
          	<a th:href="@{'/statis/deliveryView?ck_id='+${delivery.ck_id}}" class="tablelink">查看详情</a>
          </td>
        </tr>
<!--        <tr>-->
<!--          <td>2</td>-->
<!--          <td>武汉71号仓库</td>-->
<!--          <td>柳传志</td>-->
<!--          <td>湖北武汉</td>-->
<!--          <td>8</td>-->
<!--          <td>￥9,876,582</td>-->
<!--          <td>-->
<!--          	<a href="deliveryView.html" class="tablelink">查看详情</a>-->
<!--          </td>-->
<!--        </tr>-->
      </tbody>
    </table>
    <div class="pagin">
      <input type="hidden" name="pageNum" id="pageNum" th:value="${deliveryStatisList.pageNum}"/>
      <input type="hidden" name="totalPage" id="totalPage" th:value="${deliveryStatisList.totalPage}"/>
      <div class="message">共<i class="blue" th:text="${deliveryStatisList.totalRows}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${deliveryStatisList.pageNum}" >2&nbsp;</i>页,总页数为<i class="blue" th:text="${deliveryStatisList.totalPage}"></i></div>
      <ul class="paginList">
        <li class="paginItem" id="shangyiye" onclick="shang()">上一页</li>
        <li class="paginItem"><input type="text" th:value="${deliveryStatisList.pageNum}" id="textFind" name="textFind" style="width: 40px;margin: 0 5px"/></li>
        <li class="paginItem" id="xiayiye" onclick="xia()">下一页</li>
      </ul>
    </div>
  </form>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
    function chaxun(){
      $("#customStatisForm").submit();
    }
    $("#textFind").blur(function (){
      var pageNum = $("#textFind").val();
      $("#pageNum").val(pageNum);
      $("#customStatisForm").submit();
    })
    function shang(){
      var pageNum = $("#pageNum").val();
      if (pageNum > 1){
        pageNum--;
        $("#pageNum").val(pageNum);
      }
      $("#customStatisForm").submit();
    }
    function xia(){
      var pageNum = $("#pageNum").val();
      var totalPage = $("#totalPage").val();
      if (pageNum < totalPage){
        pageNum++;
        $("#pageNum").val(pageNum);
      }
      $("#customStatisForm").submit();
    }
    $("#provinceId").change(function (){
      var provinceId = $("#provinceId").val();
      if(provinceId != null && provinceId != ""){
        $.ajax({
          url: "/statis/queryCity",
          data: {"provinceId": provinceId},
          dataType: "JSON",
          success:function (data){
            /*清空城市数据*/
            $("#cityId").html("");
            var options = "<option value=''>请选择城市</option>";
            var arr=null;
            if(typeof data=='string')
              arr=JSON.parse(data);
            else
              arr=data;
            $.each(arr, function (i,obj){
              options += "<option value='"
                      + obj.id
                      + "'>"
                      + obj.cname
                      + "</option>";
            });
            $("#cityId").html(options);
          },
          error:function (){
            alert(222);
          }
        });
      }else {
        /*清空城市数据*/
        $("#cityId").html("");
        var options = "<option value=''>请选择城市</option>";
        $("#cityId").append(options);
      }
    });
</script>
</body>
</html>
